package com.yanqu.road.server.cmd.activity.summergames;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.SummerGamesProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.summergames.CrossSummerGamesActivity;
import com.yanqu.road.server.manager.activity.summergames.CrossSummerGamesMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_SUMMER_GAMES_EXCHANGE_GET_DONE_REWARD, desc = "申请者领取交换成功的邮件")
public class CrossSummerGamesExchangeDoneRewardCmd extends CrossCommand{

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

        SummerGamesProto.CrossSummerGamesExchangeDoneRewardMsg msg = SummerGamesProto.CrossSummerGamesExchangeDoneRewardMsg.parseFrom(packet.getBytes());
        int activityId = msg.getActivityId();
        CrossSummerGamesActivity activity = CrossSummerGamesMgr.getActivity(activityId);
        if(activity != null){
            activity.getExchangeReward(serverId, packet.getPlayerId(), msg.getId());
        }

    }

    @Override
    public void sendData() {

    }
}
